package bidsanity

class ListingController {

    def index() { [listingInstanceList: Listing.list(params), listingInstanceTotal: Listing.count()] }

    def show() {
        def listing = Listing.get(params.id)
        if (!listing) {
            flash.message = message(code: 'default.not.found.message', args: [message(code: 'listing.label', default:  'Listing'), params.id])
            redirect(action: "index")
            return
        }

        Listing.get(params.id).bids.sort{-1*it.amount}
        
        [ listing: listing ]
    }
}
